package com.shuma.auth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shuma.auth.mapper.OperateRecordMapper;
import com.shuma.auth.model.dto.PageParams;
import com.shuma.auth.model.po.OperateRecord;
import com.shuma.auth.service.OperateRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lele
 */
@Slf4j
@Service
public class OperateRecordServiceImpl extends ServiceImpl<OperateRecordMapper, OperateRecord> implements OperateRecordService {

    @Resource
    OperateRecordMapper operateRecordMapper;
    @Override
    public Page<OperateRecord> pageOperateRecord(PageParams pageParams) {
        Page<OperateRecord> operateRecordPage = new Page<>(pageParams.getPageNo(),pageParams.getPageSize());
        LambdaQueryWrapper<OperateRecord> operateRecordLambdaQueryWrapper = new LambdaQueryWrapper<>();
        operateRecordLambdaQueryWrapper.orderByDesc(OperateRecord::getUpdateTime);
        //所有记录数据
        Page<OperateRecord> recordPage = operateRecordMapper.selectPage(operateRecordPage, operateRecordLambdaQueryWrapper);
        return recordPage;
    }
}
